"use strict";
//装饰器 牛逼  普通装饰器 装饰器工厂
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
//类装饰器
var classDecorator = function (param) { return function (target) {
    console.log("class " + target);
    target.prototype.url = param;
}; };
//属性装饰器
var propDecorator = function (param) { return function (target, name) {
    console.log("props " + target);
    console.log(name);
    target[name] = param;
    //注意这里并不是改变了实例的属性 而是给原型对象添加了一个属性，当实例属性的值是undefined的时候 默认会取prototype里面的值
}; };
//方法装饰器
var methordDecorator = function (param) { return function (target, name, descriptor) {
    console.log("methord " + target);
    console.log(name);
    var m = descriptor.value;
    descriptor.value = function () {
        console.log("new say");
        m.call(this);
    };
}; };
var HelloWold = /** @class */ (function () {
    function HelloWold() {
    }
    HelloWold.prototype.say = function () {
        console.log("My say is " + this.name);
    };
    __decorate([
        propDecorator("hello")
    ], HelloWold.prototype, "name", void 0);
    __decorate([
        methordDecorator("world")
    ], HelloWold.prototype, "say", null);
    HelloWold = __decorate([
        classDecorator("www.baidu.com")
    ], HelloWold);
    return HelloWold;
}());
var hw = new HelloWold();
hw.say();
